package com.jiang.common.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Administrator
 */
@Configuration
public class MyWebConfig implements WebMvcConfigurer {
    @Autowired
    @Qualifier(value = "loginInterceptor")
    private HandlerInterceptor handlerInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration interceptorRegistration
                = registry.addInterceptor(handlerInterceptor);
        interceptorRegistration.addPathPatterns("/**");

        interceptorRegistration.excludePathPatterns(
                "/user/login",
                "/user/logout",
                "/login",
                "/api/**",
                "/css/**",
                "/images/**",
                "/js/**",
                "/layui/**",
                "/lib/**",
                "/captcha",
                "/webjars/**");

    }

}
